import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *


class MyWindow(QWidget):
    def __init__(self):
        super(MyWindow, self).__init__()
        self.setWindowTitle('vroSlider')

        self.super_parameter = {
            'speed': 10,
            'pitch': 10,
            'range': 10,
            'anger': 10,
            'sadness': 10,
            'joy': 10,
        }

        self.speed_sl = QSlider(Qt.Horizontal)
        self.speed_sl.setMinimum(5)
        self.speed_sl.setMaximum(40)
        self.speed_sl.setSingleStep(1)
        self.speed_sl.setValue(10)
        self.speed_sl.valueChanged.connect(self.change_speed_value)
        self.pitch_sl = QSlider(Qt.Horizontal)
        self.pitch_sl.setMinimum(5)
        self.pitch_sl.setMaximum(20)
        self.pitch_sl.setSingleStep(1)
        self.pitch_sl.setValue(10)
        self.pitch_sl.valueChanged.connect(self.change_pitch_value)
        self.range_sl = QSlider(Qt.Horizontal)
        self.range_sl.setMinimum(0)
        self.range_sl.setMaximum(20)
        self.range_sl.setSingleStep(1)
        self.range_sl.setValue(10)
        self.range_sl.valueChanged.connect(self.change_range_value)

        self.speed_label = QLabel('speed:1.0')
        self.pitch_label = QLabel('pitch:1.0')
        self.range_label = QLabel('range:1.0')

        speed_select_layout = QHBoxLayout()
        speed_select_layout.addWidget(self.speed_sl)
        speed_select_layout.addWidget(self.speed_label)

        pitch_select_layout = QHBoxLayout()
        pitch_select_layout.addWidget(self.pitch_sl)
        pitch_select_layout.addWidget(self.pitch_label)

        range_select_layout = QHBoxLayout()
        range_select_layout.addWidget(self.range_sl)
        range_select_layout.addWidget(self.range_label)

        vro1_attr_layout = QVBoxLayout()
        speed_select_layout_widget = QWidget()
        pitch_select_layout_widget = QWidget()
        range_select_layout_widget = QWidget()
        speed_select_layout_widget.setLayout(speed_select_layout)
        pitch_select_layout_widget.setLayout(pitch_select_layout)
        range_select_layout_widget.setLayout(range_select_layout)

        vro1_attr_layout.addWidget(speed_select_layout_widget)
        vro1_attr_layout.addWidget(pitch_select_layout_widget)
        vro1_attr_layout.addWidget(range_select_layout_widget)

        # next is vro2 attr anger
        self.anger_sl = QSlider(Qt.Vertical)
        self.anger_sl.setMinimum(0)
        self.anger_sl.setMaximum(10)
        self.anger_sl.setSingleStep(1)
        self.anger_sl.setValue(0)
        self.anger_sl.valueChanged.connect(self.change_anger_value)
        self.anger_label = QLabel('anger:0.0')
        anger_select_layout = QVBoxLayout()
        anger_select_layout.addWidget(self.anger_sl)
        anger_select_layout.addWidget(self.anger_label)
        anger_select_layout_widget = QWidget()
        anger_select_layout_widget.setLayout(anger_select_layout)

        # next is vro2 attr sadness
        self.sadness_sl = QSlider(Qt.Vertical)
        self.sadness_sl.setMinimum(0)
        self.sadness_sl.setMaximum(10)
        self.sadness_sl.setSingleStep(1)
        self.sadness_sl.setValue(0)
        self.sadness_sl.valueChanged.connect(self.change_sadness_value)
        self.sadness_label = QLabel('sadness:0.0')
        sadness_select_layout = QVBoxLayout()
        sadness_select_layout.addWidget(self.sadness_sl)
        sadness_select_layout.addWidget(self.sadness_label)
        sadness_select_layout_widget = QWidget()
        sadness_select_layout_widget.setLayout(sadness_select_layout)

        # next is vro2 attr joy
        self.joy_sl = QSlider(Qt.Vertical)
        self.joy_sl.setMinimum(0)
        self.joy_sl.setMaximum(10)
        self.joy_sl.setSingleStep(1)
        self.joy_sl.setValue(0)
        self.joy_sl.valueChanged.connect(self.change_joy_value)
        self.joy_label = QLabel('joy:0.0')
        joy_select_layout = QVBoxLayout()
        joy_select_layout.addWidget(self.joy_sl)
        joy_select_layout.addWidget(self.joy_label)
        joy_select_layout_widget = QWidget()
        joy_select_layout_widget.setLayout(joy_select_layout)

        # vro2 attrs group
        vro2_attr_layout = QHBoxLayout()

        vro2_attr_layout.addWidget(anger_select_layout_widget)
        vro2_attr_layout.addWidget(sadness_select_layout_widget)
        vro2_attr_layout.addWidget(joy_select_layout_widget)

        # self.setLayout(vro1_attr_layout)
        self.setLayout(vro2_attr_layout)

    def change_speed_value(self):
        self.super_parameter['speed'] = self.speed_sl.value()
        self.speed_label.setText('speed:' + str(self.super_parameter['speed'] / 10.0))

    def change_pitch_value(self):
        self.super_parameter['pitch'] = self.pitch_sl.value()
        self.pitch_label.setText('pitch:' + str(self.super_parameter['pitch'] / 10.0))

    def change_range_value(self):
        self.super_parameter['range'] = self.range_sl.value()
        self.range_label.setText('range:' + str(self.super_parameter['range'] / 10.0))

    def change_anger_value(self):
        self.super_parameter['anger'] = self.anger_sl.value()
        self.anger_label.setText('anger:' + str(self.super_parameter['anger'] / 10.0))

    def change_sadness_value(self):
        self.super_parameter['sadness'] = self.sadness_sl.value()
        self.sadness_label.setText('sadness:' + str(self.super_parameter['sadness'] / 10.0))

    def change_joy_value(self):
        self.super_parameter['joy'] = self.joy_sl.value()
        self.joy_label.setText('joy:' + str(self.super_parameter['joy'] / 10.0))


if __name__ == '__main__':
    app = QApplication(sys.argv)
    myshow = MyWindow()
    myshow.show()
    sys.exit(app.exec_())
